#ifndef GLOBALDEFINE_H
#define GLOBALDEFINE_H

#include <QDate>
#include <QTime>
#include <QHash>
#include <QColor>
#include <QDebug>

#define BARE_STOCKS 0

#define REG_HK 0x79  //F10, VK_F10
#define REG_HK_ID 100
#define REG_HK_ERR 01
#define REG_HK_SUC -1

#define MIC_NERVER_DIS 200
#define MIC_HIDE_DIS   201
#define MIC_ALWAYS_DIS 202


inline double KeepDecimal(double org, int digit)
{
    QString tar =  QString::number(org, 'f', digit);
    return tar.toDouble();
}

typedef struct StockOriginalInfo
{
    QString sStockCode;           //è‚¡ç¥¨ä»£ç 
    QString sStockName;           //è‚¡ç¥¨åå­—

    double  fStartPrice;          //ä»Šå¤©å¼€ç›˜ä»·
    double  fLastEndPrice;        //æ˜¨æ—¥æ”¶ç›˜ä»·
    double  fCurrentPrice;        //å½“å‰ä»·æ ¼

    double  fTopPrice;            //ä»Šæ—¥æœ€é«˜ä»·
    double  fFootPrice;           //ä»Šæ—¥æœ€ä½Žä»·
    double  fBuyPrice;            //ç«žä¹°ä»·
    double  fSalePrice;           //ç«žå–ä»·
    double  fStockSum;            //æˆäº¤è‚¡ç¥¨æ•°
    double  fTradeValue;          //æˆäº¤é‡‘é¢

    double  fFirstBuySum;         //ä¹°ä¸€æ•°
    double  fFirstBuyPrice;       //ä¹°ä¸€ä»·
    double  fSecondBuySum;        //ä¹°äºŒæ•°
    double  fSecondBuyPrice;      //ä¹°äºŒä»·
    double  fThirdBuySum;         //ä¹°ä¸‰æ•°
    double  fThirdBuyPrice;       //ä¹°ä¸‰ä»·
    double  fFourthBuySum;        //ä¹°å››æ•°
    double  fFourthBuyPrice;      //ä¹°å››ä»·
    double  fFifthBuySum;         //ä¹°äº”æ•°
    double  fFifthBuyPrice;       //ä¹°äº”ä»·

    double  fFirstSaleSum;        //å–ä¸€æ•°
    double  fFirstSalePrice;      //å–ä¸€ä»·
    double  fSecondSaleSum;       //å–äºŒæ•°
    double  fSecondSalePrice;     //å–äºŒä»·
    double  fThirdSaleSum;        //å–ä¸‰æ•°
    double  fThirdSalePrice;      //å–ä¸‰ä»·
    double  fFourthSaleSum;       //å–å››æ•°
    double  fFourthSalePrice;     //å–å››ä»·
    double  fFifthSaleSum;        //å–äº”æ•°
    double  fFifthSalePrice;      //å–äº”ä»·

    QDate   dCurrentDate;         //å½“å‰æ—¥æœŸ
    QTime   tCurrentTime;         //å½“å‰æ—¶é—´

}STOCKORGINFO, *PSTOCKORGINFO;

typedef struct StockInfo
{
    QString sStockCode;           //
    QString sStockName;           //è‚¡ç¥¨åå­—

    double  fRangeExtent;
    double  fCurrentPrice;        //å½“å‰ä»·æ ¼
    double  fDifference;

    double  fStartPrice;          //ä»Šå¤©å¼€ç›˜ä»·
    double  fLastEndPrice;        //æ˜¨æ—¥æ”¶ç›˜ä»·
    double  fTopPrice;            //ä»Šæ—¥æœ€é«˜ä»·
    double  fFootPrice;           //ä»Šæ—¥æœ€ä½Žä»·

    double  fBuyPrice;            //ç«žä¹°ä»·
    double  fSalePrice;           //ç«žå–ä»·
    double  fStockSum;            //æˆäº¤è‚¡ç¥¨æ•°
    double  fTradeValue;          //æˆäº¤é‡‘é¢

    double  fPERatio;
    double  fTurnoverRate;

    double  fMAFive;
    double  fMATen;
    double  fMATwenty;
    double  fMAThirty;
    double  fMASixty;

    QDate   dCurrentDate;         //å½“å‰æ—¥æœŸ
    QTime   tCurrentTime;         //å½“å‰æ—¶é—´
    QString sRecommend;
    QColor  fgColor;
    QColor  bgColor;

}STOCKINFO, *PSTOCKINFO;

typedef struct KLineData
{
    QString  sStockCode;

    double  fMAFive;
    double  fMATen;
    double  fMATwenty;
    double  fMAThirty;
    double  fMASixty;

}KLINEDATA, *PKLINEDATA;;

#endif // GLOBALDEFINE_H
